# -*- coding: utf-8 -*-
# @Time : 2024/2/27 17:24
# @Author : ZH
# @File : 75.py
# @Software: PyCharm
from typing import List
class Solution(object):
    def sortColors(self, nums: List[int]):
        """
        :type nums: List[int]
        :rtype: None Do not return anything, modify nums in-place instead.
        """
        p0 = p1 = 0
        for index, value in enumerate(nums):
            if value == 1:
                nums[p1], nums[index] = nums[index], nums[p1]
                p1 += 1
            elif value == 1:
                nums[index], nums[p0] = nums[p0], nums[index]
                if p0 < p1:
                    nums[index], nums[p1] = nums[p1], nums[index]
                p0 += 1
                p1 += 1




